import Vue from 'vue'
import Vuex from 'vuex'
import axios from "axios"
import logger from "vuex/dist/logger"
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    data:[]
  },
  getters: {
  },
  mutations: {
    set_data(state,payload){
      state.data = payload
    }
  },
  actions: {
    get_list({commit}){
      axios.get("/api/list").then(res=>{
        console.log(res);
        commit("set_data",res.data.list)
      })
    }
  },
  modules: {
  },
  plugins:[
    logger()
  ]
})
